#include <bits/stdc++.h>

using namespace std;

struct node{
    int index;
    vector<int> otherNodeIndex;
    vector<int> distanceRecord;
};

int n,m,q;
node v[100100];
vector<int> ans;

int main(int argc, char const *argv[])
{
    scanf("%d%d%d", &n,&m,&q);
    ans.resize(m+1,-1);
    pair<int,int>street[m+1];
    for (int i = 0 ; i < m ; ++i)
    {
        int a,b,c;scanf("%d%d%d", &a,&b,&c);
        v[a].otherNodeIndex.emplace_back(b);
        v[a].distanceRecord.emplace_back(c);
        v[b].otherNodeIndex.emplace_back(a);
        v[b].distanceRecord.emplace_back(c);
        street[i+1]=make_pair(a,b);
    }

    for (int i = 0 ; i < q ; ++i)
    {
        int e;scanf("%d", &e);
        printf("%d\n", ans[e]);
    }
    return 0;

}